#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,m;
struct node
{
	int j,f;
	double rate;
	bool friend operator <(node a,node b)
	{
		return a.rate<b.rate;
	}
}a[1001];
int main()
{
	while(scanf("%d%d",&m,&n),n!=-1)
	{
		for(int i=1;i<=n;i++)
		{
			scanf("%d%d",&a[i].j,&a[i].f);
			a[i].rate=(double)a[i].f/a[i].j;//price per food
		}
		sort(a+1,a+n+1);
		double ans=0,rest=m;
		for(int i=1;i<=n;i++)
		{
			if(a[i].f<=rest)
			{
				ans+=a[i].j;
				rest-=a[i].f;
			}
			else
			{
				ans+=rest/a[i].rate;
				break;
			}
		}
		printf("%0.3lf\n",ans);
	}
	return 0;
}

